package net.suncaper.demo.service;

import net.suncaper.demo.domain.Hotel;
import net.suncaper.demo.domain.RoomType;
import net.suncaper.demo.domain.HotelExample;
import net.suncaper.demo.mapper.HotelMapper;
import net.suncaper.demo.mapper.RegionMapper;
import net.suncaper.demo.mapper.RoomTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class HotelServiceImpl implements HotelService {
    @Autowired
    private HotelMapper hotelMapper;

    @Autowired
    private RegionMapper regionMapper;


    @Override
    public List<Hotel> allHotel() {
        HotelExample example=new HotelExample();
        return hotelMapper.selectByExample(example);
    }

    @Override
    public Long selectByCityName(String city) {

        return regionMapper.selectByCityName(city);
    }





    @Override
    public List<Hotel> selectByInput1(Long cityID, String key, String time,int roomnum) {
        return hotelMapper.selectByInput1(cityID,key,time,roomnum);
    }

    @Override
    public List<Hotel> selectByInput2(Long cityID, String key, String time, double pricelow, double pricehigh, double score, int star,int roomnum) {
        return hotelMapper.selectByInput2(cityID,key,time,pricelow,pricehigh,score,star,roomnum);
    }

    @Override
    public Hotel selectByID(Long cityID, Long hotelID) {
        return hotelMapper.selectByID(cityID,hotelID);
    }

    @Override
    public List<Hotel> selectHotelFromCity(Long cityID){return  hotelMapper.selectHotelFromCity(cityID);}

}
